{% extends "disease_pipeline_template.html" %}

{% block pageName %}BioVenturist Report{% endblock %}

{% block queryScriptReport %}
<script type="text/javascript" src="/reports/static/js/disease_pipeline_read.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript" src="/reports/static/js/direct_edit.js"></script>

<script language="javascript" type="text/javascript">

google.load("visualization", "1", {packages:["table"]});
google.load("visualization", "1", {packages:["imagebarchart"]});
google.load("visualization", "1", {packages:["columnchart"]});

function load_info() {
	perform_touch('{{ domain_used }}');
	
	var url_read = "http://{{ domain_used }}/api/service/mqlread";
	var url_write = "http://{{ domain_used }}/api/service/mqlwrite";
	
	//var type = '{{ bioventurist_domain }}'+'bv_medical_condition';
	//var matchType = '/medicine/disease';
	//test_type(url_read, '{{ domain_used }}', __DISEASE__NAME__, type,matchType,'disease');
	var topic_id = parseTopicID("{{ topic_id }}")
	get_content(url_read, url_write, '{{ domain_used }}','{{ bioventurist_domain }}', topic_id);
}

</script>
{% endblock %}

{% block col2_container %}
<script type="text/javascript">
	$(document).ready(function(){
		var input_html = $("input[name='html']");
		var div_report = $("#report");

		var url_convert = "http://bioventurist.appspot.com{% url reports.views.convert_images %}";
		
		function urlencode(str) { 
		  return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40'); 
		}
		
		$("input[type='submit']").click(function(){
			
			div_report.find("img").each(function(){
				var original_src = $(this).attr("src");
				$(this).attr("src", url_convert+"?src="+urlencode(original_src));
			});
			
			div_report.find("table").each(function(){
				$(this).attr("border", "1");
			});
			var temp_container = $("<div></div>")
			temp_container.html(div_report.html()).find("a.overview_edit").remove();
			input_html.val(temp_container.html());
			$("form").submit();
		});
		
		$("#create_pdf").ajaxStop(function(){
			$(this).show();
		});
		
		$("div.overview").css("text-align", "left");
		
	});
</script>
<style type="text/css">
	a.overview_edit, a.cancel {
		color: blue;
		cursor: pointer;
		cursor: hand;
	}
		
</style>
<div id="create_pdf" style="display:none;">
	<form action="{% url reports.views.report2pdf report_name %}" method="POST" onsubmit="javascript: return false;">
		<input type="hidden" value="" name="html" />
		<input type="submit" value="Generate pdf Report" />
	</form>
</div>
<div id="report">
	<center>
		<h1>BioVenturist Report - Pipeline analysis </h1>
		<br></br><br></br>
		<h3>Table of Contents</h3>
		<h3>Overview</h3>
		
		<div id="overview" class="overview">{{ report.overview|linebreaksbr }}</div>
		<a href="{% url reports.views.overview_update topic_id %}" onclick="javascript: return false;" class="overview_edit">[ Edit ]</a>
			
		<h3>Current Treatment</h3>
		<div id="treatment" class="overview">{{ report.treatment|linebreaksbr }}</div>
		<a href="{% url reports.views.overview_update topic_id %}" onclick="javascript: return false;" class="overview_edit">[ Edit ]</a>

		<h2> Therapeutics by Company </h2>
		<div id="Chart">
			<h3>Therapeutics by Stage of Development</h3>
			<div id="bar_chart_div"></div>
			<br></br>
		</div>
		<div id="Table">
			<h3>Therapeutics by Stage of Development</h3>
			<br></br>
			<center>
				<div id="table_div"></div>
			</center>
		</div>
		<br></br><br></br>
	</center>
	<div id="companies_div"></div>
</div>
{% endblock %}
